<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>递归算法</title>
</head>

<body>
	<div id="Numfactorial"></div>
	<script type="text/javascript">
		/** js递归求阶乘 */
		function Numfactorial(num) {
			if (num <= 1) {
				return 1
			} else {
				return num * Numfactorial(num - 1)
			}
		}
		document.getElementById("Numfactorial").innerHTML = `阶乘的值为：${Numfactorial(5)}`

		function move1({ x = 0, y = 0 } = {}) {
			return [x, y]
		}

		function move2({ x, y } = { x: 0, y: 0 }) {
			return [x, y]
		}

		console.log(move1({ x: 1, y: 2 }));
		console.log(move1({ x: 1 }));
		console.log(move1({}));
		console.log(move1());

		console.log(move2({ x: 1, y: 2 }));
		console.log(move2({ x: 1 }));
		console.log(move2({}));
		console.log(move2());

	</script>
</body>

</html>